﻿Imports Sy.Data
Imports Sy.UI.Common

Public Class SERPMasterResponse
    Inherits JsonObject(Of SERPMasterResponse)
    Public Property results As List(Of ResultsItem)
    Public Class ResultsItem
        Public Property url As String
        Public Property content As ContentItem

        Public Class ContentItem
            Public Property url As String
            Public Property page As Integer
            Public Property results As ResultsItem

            Public Class ResultsItem
                Public Property organic As List(Of OrganicItem)

                Public Class OrganicItem
                    Inherits SqlObject(Of OrganicItem)
                    Public Sub New() : End Sub
                    Public Sub New(url As String)
                        Me.url = url
                        Try
                            Dim uri As New Uri(url)
                            _domain = uri.DnsSafeHost
                        Catch ex As Exception
                            _domain = url
                        End Try
                    End Sub
                    'Public Property pos As Integer
                    Private Property _domain As String
                    ''' <summary>
                    ''' 域名
                    ''' </summary>
                    ''' <returns></returns>
                    <UIAdapter("Ltv_1_Domain", 155)>
                    Public Property domain As String
                        Get
                            If _domain.IsNullOrEmpty() Then
                                Try
                                    Dim uri As New Uri(url)
                                    _domain = uri.DnsSafeHost
                                Catch ex As Exception
                                    _domain = url
                                End Try
                            End If
                            Return _domain
                        End Get
                        Set(value As String)
                            _domain = value
                        End Set
                    End Property
                    ''' <summary>
                    ''' URL路径
                    ''' </summary>
                    ''' <returns></returns>
                    <UIAdapter("Ltv_1_URL", 100)>
                    Public ReadOnly Property Path As String
                        Get
                            Try
                                Dim uri As New Uri(Sy.Text.Encode.Url_Decode(url))
                                Return uri.AbsolutePath
                            Catch ex As Exception
                                Return url
                            End Try
                        End Get
                    End Property
                    Public Property url As String
                    ''' <summary>
                    ''' 网站内容
                    ''' </summary>
                    ''' <returns></returns>
                    <UIAdapter("Ltv_1_WebsiteIntroduction", 130)>
                    Public Property desc As String
                    ''' <summary>
                    ''' 标题
                    ''' </summary>
                    ''' <returns></returns>
                    <UIAdapter("Ltv_1_WebsiteTitle", 100)>
                    Public Property title As String
                    Public Property url_shown As String
                    'Public Property EmailsItem As List(Of DomainSearchResponse.EmailsItem)
                End Class
            End Class
        End Class

        Public Property job_id As String
        Public Property page As Integer
        Public Property status_code As Integer
        Public Property created_at As String
        Public Property updated_at As String
    End Class
End Class
